﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using V = Science.Mathematics.VectorCalculus;

namespace VectorCalculus5Ed.Chapter2.Section4
{
    public class Example02
    {
        public Example02()
		{
		}
		private string result;
		public string Result
		{
			get{return result;}
		}
        public void Compute()
        {
            V.Function.ToLastType<double, double[]> map
                = new V.Function.ToLastType<double, double[]>(func);
            V.Path p = new V.Path(map);
            p.ParameterFrom = 0.0;
            p.ParameterTo = Math.PI;
            V.Curve c = new V.Curve(p);
            c.Find(0.01);
            for (int i = 0; i < c.CoordinatesOfPoints.Count; i++)
            {
                double[] y = (double[])c.CoordinatesOfPoints[i];
                result += y[0].ToString() + "\t  ";
                result += y[1].ToString() + "\r\n";
            }
        }
        private double[] func(double t)
        {
            double[] r = new double[2];
            r[0] = Math.Cos(2.0*t);
            r[1] = Math.Sin(2.0*t);
            return r;
        }
    }
}
/*
1	  0
0.999800006666578	  0.0199986666933331
0.999200106660978	  0.0399893341866342
0.998200539935204	  0.0599640064794446
0.996801706302619	  0.0799146939691727
0.995004165278026	  0.0998334166468282
0.992808635853866	  0.119712207288919
0.990215996212637	  0.139543114644236
0.987227283375627	  0.159318206614246
0.983843692788121	  0.179029573425824
0.980066577841242	  0.198669330795061
0.975897449330606	  0.218229623080869
0.97133797485203	  0.237702626427135
0.966389978134513	  0.257080551892155
0.961055438310771	  0.276355648564114
0.955336489125606	  0.29552020666134
0.949235418082441	  0.314566560616118
0.942754665528346	  0.333487092140814
0.935896823677935	  0.35227423327509
0.92866463557651	  0.370920469412983
0.921060994002885	  0.389418342308651
0.913088940312308	  0.40776045305957
0.904751663219963	  0.425939465066
0.896052497525525	  0.44394810696552
0.886994922779284	  0.461779175541483
0.877582561890373	  0.479425538604203
0.86781917967765	  0.496880137843737
0.857708681363824	  0.514135991653113
0.847255111013416	  0.531186197920883
0.836462649915187	  0.548023936791874
0.825335614909678	  0.564642473395035
0.813878456662534	  0.581035160537305
0.802095757884293	  0.597195441362392
0.789992231497365	  0.613116851973434
0.777572718750928	  0.628793024018469
0.764842187284488	  0.644217687237691
0.751805729140895	  0.659384671971473
0.738468558729588	  0.674287911628145
0.724836010740905	  0.688921445110551
0.710913538012277	  0.70327941920041
0.696706709347165	  0.717356090899523
0.682221207287613	  0.731145829726896
0.667462825841308	  0.744643119970859
0.652437468164052	  0.757842562895277
0.63715114419858	  0.770738878898969
0.621609968270664	  0.783326909627483
0.605820156643463	  0.795601620036366
0.589788025031098	  0.807558100405114
0.573519986072457	  0.819191568300998
0.557022546766217	  0.83049737049197
0.54030230586814	  0.841470984807897
0.52336595125165	  0.852108021949363
0.506220257232778	  0.862404227243338
0.488872081860528	  0.872355482344986
0.47132836417374	  0.881957806884948
0.453596121425577	  0.891207360061435
0.435682446276712	  0.900100442176505
0.417594503958358	  0.908633496115883
0.399339529406273	  0.916803108771767
0.380924824366882	  0.92460601240802
0.362357754476674	  0.932039085967226
0.343645746316047	  0.939099356319068
0.324796284438776	  0.945783999449539
0.305816908378289	  0.952090341590516
0.286715209631956	  0.958015860289225
0.267498828624587	  0.963558185417193
0.248175451652373	  0.968715100118265
0.228752807808459	  0.973484541695319
0.209238665891419	  0.977864602435316
0.189640831297834	  0.98185353037236
0.169967142900241	  0.98544972998846
0.150225469911686	  0.98865176285172
0.130423708738146	  0.991458348191686
0.11056977982007	  0.993868363411645
0.0906716244643097	  0.99588084453764
0.0707372016677029	  0.997494986604054
0.0507744849335792	  0.998710143975583
0.0307914590824661	  0.999525830605479
0.0107961170582674	  0.999941720229966
-0.00920354326880834	  0.99995764649874
-0.0291995223012888	  0.999573603041505
-0.0491838219141706	  0.998789743470524
-0.0691484486540622	  0.997606381319174
-0.0890854169364592	  0.996023989916537
-0.108986752239871	  0.994043202198076
-0.128844494295525	  0.991664810452469
-0.148650700271364	  0.988889766004701
-0.168397447949077	  0.985719178835553
-0.18807683889288	  0.982154317137618
-0.207681001608784	  0.978196606808045
-0.227202094693087	  0.973847630878195
-0.246632309968834	  0.969109128880456
-0.26596387560898	  0.963982996152448
-0.285189059245021	  0.958471283078914
-0.304300171059833	  0.952576194271595
-0.323289566863504	  0.946300087687414
-0.342149651150898	  0.939645473685325
-0.360872880139767	  0.9326150140222
-0.379451764788155	  0.925211520788168
-0.397878873789916	  0.91743795528181
-0.416146836547142	  0.909297426825682
-0.4342483461183	  0.900793191522627
-0.452176162140912	  0.89192865095338
-0.469923113727602	  0.882707350815974
-0.487482102334359	  0.873132979507516
-0.504846104599858	  0.863209366648874
-0.522008175154707	  0.852940481552876
-0.538961449399512	  0.842330431636646
-0.555699146250613	  0.831383460778683
-0.572214570852437	  0.820103947621374
-0.588501117255346	  0.80849640381959
-0.60455227105793	  0.796565472236087
-0.62036161201268	  0.78431592508442
-0.635922816594003	  0.771752662020126
-0.651229660527546	  0.758880708180922
-0.666276021279824	  0.74570521217672
-0.681055880507152	  0.732231444030251
-0.695563326462902	  0.718464793069126
-0.70979255636212	  0.704410765770176
-0.723737878702569	  0.690074983556936
-0.737393715541245	  0.675463180551151
-0.750754604725491	  0.660581201279201
-0.763815202077774	  0.645434998334371
-0.776570283533293	  0.630030629995892
-0.789014747229531	  0.614374257805712
-0.801143615546934	  0.598472144103957
-0.81295203709989	  0.582330649524082
-0.824435288677222	  0.565956230448703
-0.835588777131408	  0.549355436427127
-0.846408041215776	  0.532534907555621
-0.856888753368947	  0.515501371821464
-0.867026721445802	  0.498261642411839
-0.876817890394281	  0.480822614988648
-0.886258343877352	  0.463191264930345
-0.895344305839492	  0.445374644541871
-0.904072142017061	  0.42737988023383
-0.912438361391958	  0.409214169672017
-0.920439617587981	  0.390884778898452
-0.928072710209333	  0.372399039425055
-0.935334586120739	  0.353764345301143
-0.942222340668658	  0.334988150155905
-0.948733218843107	  0.316077964217054
-0.954864616379626	  0.297041351306832
-0.960614080800952	  0.277885925816587
-0.965979312397975	  0.258619349661111
-0.970958165149591	  0.239249329213982
-0.975548647581083	  0.219783612225117
-0.979748923560684	  0.200229984721771
-0.983557313034006	  0.180596267894233
-0.986972292696038	  0.160890314967456
-0.989992496600445	  0.141120008059867
-0.992616716705937	  0.12129325503063
-0.994843903359459	  0.101417986316602
-0.996673165716047	  0.0815021517602691
-0.998103772095146	  0.0615537174299131
-0.999135150273279	  0.0415806624332905
-0.999766887712928	  0.021590975726096
-0.99999873172754	  0.00159265291648683
-0.999830589582598	  -0.0184063069330538
-0.999262528532721	  -0.0383979045052354
-0.998294775794753	  -0.0583741434275801
-0.996927718456887	  -0.0783270334708653
-0.99516190332383	  -0.0982485937451087
-0.992998036698093	  -0.118130855891818
-0.990436984097473	  -0.137965867271227
-0.987479769908865	  -0.157745694143249
-0.984127576978515	  -0.177462424840861
-0.980381746138899	  -0.19710817293467
-0.97624377567241	  -0.21667508038738
-0.971715320712062	  -0.236155320696897
-0.966798192579461	  -0.255541102026831
-0.961494358060299	  -0.274824670323124
-0.955805938617666	  -0.293998312415568
-0.949735209543496	  -0.31305435910297
-0.943284599048476	  -0.331985188220734
-0.936456687290796	  -0.35078322768962
-0.929254205344123	  -0.369440958544477
-0.921680034105203	  -0.38795091794173
-0.913737203141545	  -0.406305702144417
-0.90542888947963	  -0.424497969483583
-0.896758416334147	  -0.442520443294852
-0.88772925177875	  -0.460365914828998
-0.878345007358874	  -0.478027246135343
-0.868609436647165	  -0.495497372916845
-0.858526433742102	  -0.512769307355724
-0.848100031710408	  -0.529836140908493
-0.83733440097388	  -0.546691047069287
-0.826233847641272	  -0.56332728410037
-0.814802811785912	  -0.579738197728743
-0.803045865669731	  -0.595917223807764
-0.790967711914417	  -0.611857890942719
-0.778573181620432	  -0.627553823079294
-0.765867232434637	  -0.642998742053909
-0.752854946567295	  -0.658186470104905
-0.739541528759258	  -0.673110932343562
-0.72593230420014	  -0.687766159183974
-0.71203271639831	  -0.702146288730805
-0.697848325003564	  -0.716245569123971
-0.683384803583336	  -0.7300583608393
-0.668647937353351	  -0.743579138944275
-0.653643620863612	  -0.756802495307928
-0.638377855640659	  -0.769723140764024
-0.622856747787041	  -0.782335907226653
-0.607086505538954	  -0.794635749757397
-0.591073436783031	  -0.806617748583241
-0.574823946533269	  -0.81827711106441
-0.55834453436911	  -0.829609173611371
-0.541641791835699	  -0.840609403550195
-0.524722399807346	  -0.851273400935574
-0.507593125815277	  -0.861596900310741
-0.490260821340699	  -0.871575772413588
-0.47273241907431	  -0.881206025828325
-0.455014930143305	  -0.890483808581989
-0.437115441307028	  -0.899405409685178
-0.419041112122356	  -0.907967260616405
-0.400799172079975	  -0.916165936749455
-0.38239691771268	  -0.923998158723188
-0.363841709676858	  -0.931460793753243
-0.345140969808323	  -0.938550856885108
-0.326302178153684	  -0.945265512188063
-0.307332869978419	  -0.951602073889516
-0.288240632752882	  -0.957558007449271
-0.269033103117399	  -0.963130930573317
-0.249717963827731	  -0.968318614166707
-0.230302940682059	  -0.973118983225174
-0.21079579943078	  -0.977530117665097
-0.191204342670301	  -0.981550253091516
-0.171536406722112	  -0.985177781503859
-0.151799858498355	  -0.988411251939131
-0.13200259235517	  -0.991249371052267
-0.112152526935054	  -0.993691003633465
-0.0922576019995117	  -0.995735173062245
-0.0723257752532545	  -0.997381061698093
-0.0523650191612259	  -0.998628011207499
-0.0323833177597247	  -0.999475522827284
-0.0123886634628906	  -0.999923257564101
0.0076109461341479	  -0.999971036330024
0.0276075114542115	  -0.999618840014185
0.0475930341377878	  -0.998866809490414
0.0675595202422752	  -0.997715245560893
0.0874989834394464	  -0.996164608835841
0.10740344820988	  -0.994215519549271
0.127264953033056	  -0.991868757310913
0.147075553571863	  -0.98912526079437
0.166827325850222	  -0.98598612736167
0.186512369422576	  -0.982452612624332
0.206122810533958	  -0.978526129941139
0.225650805269396	  -0.974208249852809
0.245088542691362	  -0.969500699453809
0.264428247964056	  -0.96440536170153
0.283662185463226	  -0.958924274663138
0.302782661870324	  -0.953059630700367
0.321782029249722	  -0.946813775592609
0.34065268810779	  -0.940189207598628
0.35938709043259	  -0.933188576457298
0.377977742712981	  -0.925814682327732
0.396417208935922	  -0.918070474669267
0.414698113560782	  -0.909959051061711
0.432813144469452	  -0.901483655966355
0.450755055891099	  -0.892647679428235
0.468516671300377	  -0.883454655720153
0.48609088628794	  -0.873908261929022
0.503470671402114	  -0.864012316485074
0.520649074960579	  -0.853770777634543
0.537619225830956	  -0.843187741856417
0.554374336179161	  -0.832267442223901
0.570907704184454	  -0.821014246711247
0.587212716720073	  -0.809432656446619
0.603282851998404	  -0.797527303911704
0.619111682179599	  -0.785302951088781
0.634692875942635	  -0.772764487555987
0.650020201017752	  -0.759916928531561
0.665087526679283	  -0.746765412867812
0.679888826197857	  -0.733315200995657
0.694418179251016	  -0.719571672820507
0.70866977429126	  -0.705540325570392
0.722637910870592	  -0.691226771597126
0.736317001920619	  -0.676636736131457
0.749701575987308	  -0.661776054993037
0.762786279419489	  -0.646650672256183
0.77556587851025	  -0.631266637872321
0.788035261590348	  -0.615630105250086
0.800189441072806	  -0.599747328794044
0.812023555447886	  -0.583624661403007
0.823532871227622	  -0.567268551928969
0.83471278483916	  -0.550685542597638
0.845558824466117	  -0.533882266391644
0.856066651837255	  -0.516865444397429
0.866232063961728	  -0.499641883116902
0.876050994810224	  -0.482218471744932
0.885519516941319	  -0.464602179413757
0.894633843072407	  -0.44680005240543
0.903390327594559	  -0.428819211333396
0.911785468030717	  -0.410666848294341
0.919815906436639	  -0.392350223991454
0.927478430744036	  -0.373876664830236
0.934769976045349	  -0.355253559988043
0.941687625819678	  -0.336488358458504
0.948228613099346	  -0.317588566072035
0.954390321576654	  -0.298561742493594
0.960170286650366	  -0.279415498198926
0.965566196411518	  -0.260157491430468
0.970575892568149	  -0.240795425134159
0.975197371308593	  -0.221337043878359
0.979428784102971	  -0.201790130756129
0.983268438442585	  -0.182162504272095
0.986714798516892	  -0.162462015215154
0.989766485827815	  -0.142696543518258
0.992422279741117	  -0.12287399510655
0.994681117974643	  -0.103002298735098
0.996542097023218	  -0.0830894028174964
0.998004472520033	  -0.0631432722466128
0.99906765953439	  -0.0431718852087287
0.999731232805658	  -0.0231832299923794
*/
